import java.io.File;

public class XMLDataSource<T> extends FileDataSource {

    private JaxbUtil jaxbUtil = new JaxbUtil();

    private Class<T> clz;

    public XMLDataSource(Class<T> clz, File input) {
        super(input);
        this.clz = clz;
    }

    public void create(T o) {
        update(o);
    }

    public T read() {
        return (T) jaxbUtil.readFrom(clz, file);
    }

    public void update(T o) {
        jaxbUtil.writeTo(clz, o, file);
    }

    public void delete(T o) {
        update(o);
    }

}
